<?php
namespace app\index\controller;
use think\Request;
// use think\Controller;

class Error //extends Controller
{
    protected $request;
    
    /**
     * 构造方法
     * @param Request $request Request对象
     * @access public
     */
    public function __construct(Request $request)
    {
		$this->request = $request;
    }
    public function index()
    {
        //根据当前控制器名来判断要执行那个城市的操作
        $cityName = $this->request->controller();
        return $this->city($cityName);
    }
     //注意 city方法 本身是 protected 方法
     protected function city($name)
     {
        //和$name这个城市相关的处理
        return '当前城市' . $name;
     }

}
